<!-- 报废/失效 库存详情（列表方式） -->
<template>
  <div>
    <div class="app-container" style="padding: 0">
      <el-table border :data="detailTableData" header-cell-class-name="table-header" style="width: 100%;margin-top: 20px">
        <el-table-column label="序号" type="index" width="50"></el-table-column>
        <el-table-column prop="equipmentTypeName" show-overflow-tooltip label="器材名称"></el-table-column>
        <el-table-column prop="warehouseName" show-overflow-tooltip label="所属仓库"></el-table-column>
        <el-table-column prop="batchNo" show-overflow-tooltip label="批次号"></el-table-column>
        <el-table-column prop="scrapTime" show-overflow-tooltip label="报废/失效时间"></el-table-column>
        <el-table-column prop="stockAmount" show-overflow-tooltip label="报废/失效数量"></el-table-column>
      </el-table>

      <!-- 分页DIV -->
      <div style="text-align: right;margin-top: 20px">
        <el-pagination
          background
          @size-change="handleExceptionSizeChange"
          @current-change="handleExceptionCurrentChange"
          :current-page="currentDetailPage"
          :page-sizes="[10, 15, 30]"
          :page-size="detailPageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="detailTotal">
        </el-pagination>
      </div>
    </div>
  </div>
</template>


<script>//TODO 李怀北这个页面还没测试
import { getDetailScrapList } from '@/api/warehouse'


export default {
  name: 'StockDetailScrap',
  //父传子第四步：接收变量
  props:['parentEquipmentTypeId','parentWarehouseId','parentStockStatus'],//接受父级传递的数据（组件在dialog中，需要通过组件属性传递参数值；如果直接使用组件则可以直接获取属性）

  data() {
    return {
      dialogVisible: false,
      replaceDialogVisible: false,
      dialogVisible2: false,
      treeProps: { value: 'id', label: 'name' },
      detailTableData: [],
      currentPage: 1,
      total: 0,
      pageSize: 10,
      currentDetailPage: 1,
      detailTotal: 0,
      detailPageSize: 10
    }
  },
  mounted() {
    this.getDetailTableData()
  },
  methods: {
    getDetailTableData() {
      const param = { page: this.currentPage, rows: this.pageSize, warehouseId: this.parentWarehouseId ,equipmentTypeId: this.parentEquipmentTypeId,status:this.parentStockStatus}
      // console.log(param);
      getDetailScrapList(param).then(res => {
        this.detailTableData = res.resultData
        this.detailTotal = res.total
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.dd {
  text-align: center;
}
</style>
